package com.hn.gege.sys.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hn.gege.sys.modules.sys.entity.AreaDict;
import com.hn.gege.sys.modules.sys.mapper.AreaDictMapper;
import com.hn.gege.sys.modules.sys.service.IAreaDictService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zxy
 * @since 2020-08-26
 */
@Service
public class AreaDictServiceImpl extends ServiceImpl<AreaDictMapper, AreaDict> implements IAreaDictService {

    @Override
    public AreaDict getByPk(String regionWbs) {
        LambdaQueryWrapper<AreaDict> lambda = new QueryWrapper<AreaDict>().lambda()
                .eq(AreaDict::getRegionWbs, regionWbs);
        return baseMapper.selectOne(lambda);
    }

    @Override
    public boolean updateByPk(AreaDict areaDict) {
        LambdaQueryWrapper<AreaDict> lambda = new QueryWrapper<AreaDict>().lambda()
                .eq(AreaDict::getRegionWbs, areaDict.getRegionWbs());
        return super.update(areaDict, lambda);
    }

    @Override
    public boolean removeByPk(String regionWbs) {
        LambdaQueryWrapper<AreaDict> lambda = new QueryWrapper<AreaDict>().lambda()
                .eq(AreaDict::getRegionWbs, regionWbs);
        return super.remove(lambda);
    }

}
